from pydantic import BaseModel, Field
from typing import Optional, List, Dict, Any
from datetime import datetime

# 品牌配置模型
class BrandConfigBase(BaseModel):
    name: str
    category: Optional[str] = None
    is_active: bool = True

class BrandConfigCreate(BrandConfigBase):
    pass

class BrandConfigUpdate(BaseModel):
    name: Optional[str] = None
    category: Optional[str] = None
    is_active: Optional[bool] = None

class BrandConfig(BrandConfigBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

# 商品名称排除模型
class CommonProductNameBase(BaseModel):
    name: str
    category: Optional[str] = None
    description: Optional[str] = None
    is_active: bool = True

class CommonProductNameCreate(CommonProductNameBase):
    pass

class CommonProductNameUpdate(BaseModel):
    name: Optional[str] = None
    category: Optional[str] = None
    description: Optional[str] = None
    is_active: Optional[bool] = None

class CommonProductName(CommonProductNameBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

# 单位配置模型
class UnitConfigBase(BaseModel):
    name: str
    type: Optional[str] = None
    is_active: bool = True

class UnitConfigCreate(UnitConfigBase):
    pass

class UnitConfigUpdate(BaseModel):
    name: Optional[str] = None
    type: Optional[str] = None
    is_active: Optional[bool] = None

class UnitConfig(UnitConfigBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

# 营销词配置模型
class MarketingWordConfigBase(BaseModel):
    word: str
    category: Optional[str] = None
    is_active: bool = True

class MarketingWordConfigCreate(MarketingWordConfigBase):
    pass

class MarketingWordConfigUpdate(BaseModel):
    word: Optional[str] = None
    category: Optional[str] = None
    is_active: Optional[bool] = None

class MarketingWordConfig(MarketingWordConfigBase):
    id: int
    created_at: datetime
    updated_at: datetime

    class Config:
        from_attributes = True

# 系统配置模型
class SystemConfigBase(BaseModel):
    key: str
    value: Optional[str] = None
    description: Optional[str] = None

class SystemConfigCreate(SystemConfigBase):
    pass

class SystemConfigUpdate(BaseModel):
    value: Optional[str] = None
    description: Optional[str] = None

class SystemConfig(SystemConfigBase):
    id: int
    updated_at: datetime

    class Config:
        from_attributes = True

# 批量导入模型
class BulkCreateRequest(BaseModel):
    items: List[Dict[str, Any]]

# 批量更新状态模型
class BulkStatusUpdate(BaseModel):
    ids: List[int]
    is_active: bool 